package org.linlinjava.litemall.db.dao;

import java.util.List;

import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.linlinjava.litemall.db.domain.LitemallNotice;
import org.linlinjava.litemall.db.domain.LitemallNoticeExample;
import org.linlinjava.litemall.db.domain.LitemallNoticeWithBLOBs;
import org.linlinjava.litemall.db.dto.WxMsgTypeDTO;

public interface LitemallNoticeMapper extends MPJBaseMapper<LitemallNotice> {

    @Select("SELECT type ,\n" +
            "\t\t\tSUM(CASE WHEN mark_read=1 THEN 1 ELSE 0 END) as readNum,\n" +
            "\t\t\tSUM(CASE WHEN mark_read=0 THEN 1 ELSE 0 END) as unreadNum\n" +
            "\tFROM litemall_notice WHERE user_id = #{userId} GROUP BY type")
    List<WxMsgTypeDTO> allTypesByuser(Integer userId);
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    long countByExample(LitemallNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int deleteByExample(LitemallNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int insert(LitemallNoticeWithBLOBs record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int insertSelective(LitemallNoticeWithBLOBs record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    LitemallNotice selectOneByExample(LitemallNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    LitemallNoticeWithBLOBs selectOneByExampleSelective(@Param("example") LitemallNoticeExample example, @Param("selective") LitemallNoticeWithBLOBs.Column ... selective);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    LitemallNoticeWithBLOBs selectOneByExampleWithBLOBs(LitemallNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    List<LitemallNoticeWithBLOBs> selectByExampleSelective(@Param("example") LitemallNoticeExample example, @Param("selective") LitemallNoticeWithBLOBs.Column ... selective);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    List<LitemallNoticeWithBLOBs> selectByExampleWithBLOBs(LitemallNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    List<LitemallNotice> selectByExample(LitemallNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    LitemallNoticeWithBLOBs selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") LitemallNoticeWithBLOBs.Column ... selective);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    LitemallNoticeWithBLOBs selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    LitemallNoticeWithBLOBs selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") LitemallNoticeWithBLOBs record, @Param("example") LitemallNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int updateByExampleWithBLOBs(@Param("record") LitemallNoticeWithBLOBs record, @Param("example") LitemallNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") LitemallNotice record, @Param("example") LitemallNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(LitemallNoticeWithBLOBs record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int updateByPrimaryKeyWithBLOBs(LitemallNoticeWithBLOBs record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int updateByPrimaryKey(LitemallNotice record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int logicalDeleteByExample(@Param("example") LitemallNoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table litemall_notice
     *
     * @mbg.generated
     */
    int logicalDeleteByPrimaryKey(Integer id);
}